<?php

namespace Bean\Flow\PostsFlow;

class UserFlow extends \Bean\Flow\PostsFlow {

	private $_user;
	
	public function __construct( $flow ) {
		parent::__construct( $flow );
		$user = _q()->get1( 'users', array( 'flow_id' => $flow['flow_id'] ) );
		$this->_user = \Bean\User::getUser( $user );
	}

	public function getUser() {
		return $this->_user;
	}
	
	public function isReadable( \Bean\User $user = null ) {
		return $this->getUser()->is( $user )
			|| $this->getUser()->isContact( $user );
	}
}
